import { getStorage, setStorage } from "./localstor";
const ModuleName = 'breadcrumb';
//获取面包屑
export function getBreadcrumb() {
    const rou = getStorage(ModuleName) || {}
    return rou.breadcrumb||[]
}
//保存面包屑
export function setBreadcrumb(arr) {
    setStorage(ModuleName,{breadcrumb:arr})
}
//保存当前路由跳转项
export function setRouterPush(path,step) {
    setStorage(ModuleName, {
        routerPush: {
            formPath: path,
            step
        }
    });
}
//获取路由跳转项
export function getRouterPush() {
    const rou = getStorage(ModuleName) || {}
    return rou.routerPush || {};
}
//处理面包屑step小于等于0
export function handleBreadcrumb(step) {
    let arr = getBreadcrumb();
    if (!arr.length || !step) {
        return arr;
    } else if (arr.length <= -step) {
        arr=[]
    } else {
        arr.length = arr.length + step;
    }
    return arr;
}
